﻿package com.addcn.common.utils
{
	import it.gotoandplay.smartfoxserver.SmartFoxClient
	
	public class Server 
	{		
		private static var _ext_arr :Array ;		
		private static var _instance:SmartFoxClient;
	
		function Server() {
			//if(_instance != null){
				//throw("[Server] is a singleton class!")
			//}
		}
				
		public static function getInstance():SmartFoxClient
		{
			if ( _instance == null ) {
				_instance = new SmartFoxClient();				
			}
			
			return _instance as SmartFoxClient;
		}
		
		public static function initialize(r_ip : String, r_port:int, r_zone:String , r_ext:Array , r_debug : Boolean = false) : void
		{
			_instance.ipAddress = r_ip,
			_instance.port = r_port;
			_instance.defaultZone = r_zone;
			_instance.debug = r_debug;						
			Server._ext_arr = r_ext;			
		}
		
		public static function ext(r_index : int = 0) : String
		{
			return _ext_arr[r_index];
		}
		
	}
}
